<#import "_master.ftl" as layout />

<@layout.masterTemplate
title="Ascensori">


<section id="model">
	<div class="page-header">
		<h1>
			Ascensori
			<button class="btn" type="button" style="float:right" id="create-new">
				<i class=" icon-plus"></i>
				Crea nuovo ascensore
			</button>
		</h1>
	</div>

	<@layout.alert type="success" title="Bene!" message="Il nuovo modello è stato creato con successo." />  	
	<@layout.alert type="error" title="Oooopppps!" message="Qualcosa è andato storto." />

	<form class="bs-docs form-horizontal" style="display:none" id="form-new" method="post">
		<button type="button" class="close" title="chiudi">×</button>
		<legend>Crea nuovo ascensore</legend>
		<div class="control-group">
			<label class="control-label" for="modello">Modello</label>
			<div class="controls">
				<select type="text" id="modello" name="modello" placeholder="Modello">
					<#list modelli as modello>
						<option value="${modello.id?string.computer}">${modello.nome}</option>
					</#list>
				</select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="edificio">Edificio</label>
			<div class="controls">
				<select type="text" class="span5" id="edificio" name="edificio" width="100%" placeholder="Edificio">
					<#list edifici as edificio>
						<option value="${edificio.id?string.computer}">${edificio.indirizzo}</option>
					</#list>
				</select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="dataInstallazione">Data installazione</label>
			<div class="controls">
				<input type="text" id="dataInstallazione" name="dataInstallazione" placeholder="08/02/2012" />
			</div>
		</div>
		<div class="control-group">
			<div class="controls">
				<button type="submit" class="btn btn-primary" id="submit-new">Crea</button>
			</div>
		</div>
	</form>

	<table class="table table-striped" id="list">
		<#if (ascensori?size > 0)>
		<thead>
			<tr>
				<th>#</th>
				<th>Modello</th>
				<th>Edificio</th>
				<th>Data installazione</th>
				<th>No. interventi</th>
				<th>Azioni</th>
			</tr>
		</thead>
		<tbody>
			<#list ascensori as ascensore>
			<tr>
				<td>${ascensore.id?string.computer}</td>
				<td>${ascensore.modello.nome}</td>
				<td>${ascensore.edificio.indirizzo}</td>
				<td>${ascensore.dataInstallazione?date?string.long}</td>
				<td>${ascensore.interventi?size?string.computer}</td>
				<td><a href="/Ascensore?id=${ascensore.id?string.computer}" class="icon-eye-open" title="vedi dettagli" style="cursor:pointer"></a></td>
			</tr>
			</#list>
		</tbody>
		<#else>
		<tbody>
			<tr>
				<td colspan="5">Nessun ascensore trovato</td>
			</tr>
		</tbody>
	</#if>
	</table>
</section>



</@layout.masterTemplate>